﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
<script src="http://apps.bdimg.com/libs/jquery/1.11.3/jquery.min.js"></script>
    <!-- jqGrid组件基础样式包-必要 -->
	    <link href="js/jsgrid/css/bootstrap.min.css?v=3.3.6" rel="stylesheet" />
        <link href="js/jsgrid/css/font-awesome.css?v=4.4.0" rel="stylesheet" />
<!--    <link href="js/jsgrid/css/style.css" rel="stylesheet" />-->

        <!-- jqgrid-->
        <link href="js/jsgrid/css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet" />
        <link href="js/jsgrid/css/animate.css" rel="stylesheet" />
<!--        <link href="js/jsgrid/css/style.css?v=4.1.0" rel="stylesheet" />-->
    <!-- 全局js -->
        <script src="js/jsgrid/js/bootstrap.min.js?v=3.3.6"></script>
        <!-- Peity -->
        <script src="js/jsgrid/js/plugins/peity/jquery.peity.min.js"></script>
        <!-- jqGrid -->
        <script src="js/jsgrid/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
        <script src="js/jsgrid/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>
    <!--jsgrid-->
    <title>数据查询弹窗</title>
<link href="css/alllayer.css" rel="stylesheet" />
</head>
<body>
    <div class="layertop">
        <button>导 出</button>
        <button>打 印</button>
        <span id="date1" style="display:none;"></span>
        <span id="date2" style="display:none;"></span>
        <input type="button" value="test" hidden="hidden" />
    </div>
    <div class="jqGrid_wrapper">
        <table id="list1"></table> 
		<div id="pager1"></div>
    </div>
</body>
</html>
<script src="js/login1.js"></script>
<script>
    //jsgrid表格插件
    $(function () {

		//点击调取
        $("input[type=button]").click(function(){
       	var stime = $("#date1").html();
       	var etime = $("#date2").html();
       	loaddate(1,stime,etime);
       });
		
        
    });
		
    window.onload = function() {
    	setTimeout("loadselect()",1000);
    };
    function loadselect() {
    	$("input[type=button]").trigger("click");
    };
        
       
        
        function loaddate(typeA,startTime,EndTime){
        	$.jgrid.defaults.styleUI = 'Bootstrap';
        	var state_data={};
        	$.ajax({
        		async:false, //同步骤执行，即从后台获取json数据以后才本地装载jqgrid数据
        		cache:false,
        		type:'POST',
        		dataType:"json",
        		data:{
        			stime:startTime,
        			etime:EndTime
        		},
        		url:"CheckInfoAction_list.action",
        		error:function() {
        			alert("查询失败。123123");
        		},
        		success:function(data) {
        		    state_data = data;
        		}
        	});
            
            // Configuration for jqGrid Example 1
            $("#list1").jqGrid({
               // data: mydata,
                data:state_data,
                datatype: "local",
                height: "",
                autowidth: true,
                shrinkToFit: true,
                rowNum: 10,
                rowList: [10, 20, 30],
                colNames: [ '时间', '地点', '责任人',"联系方式",'状态'],
                colModel: [
                    {
                        name: 'date',
                        index: 'date',
                        width: 20,
                        sorttype: "date"
                    },
                    {
                        name: 'addr',
                        index: 'addr',
                        width: 45,
                        sorttype: "string",
                        formatter: "string"
                    },
                    {
                        name: 'people',
                        index: 'people',
                        width: 15
                    },
                    {
                        name: 'phone',
                        index: 'phone',
                        width: 20,
                        sorttype: "string",
                        formatter: "string"
                    },
                    {
                        name: 'state',
                        index: 'state',
                        width: 10
                    }
                ],
                pager: "#pager1",
                viewrecords: true,
                caption: "",
                add: true,
                edit: true,
                addtext: 'Add',
                edittext: 'Edit',
                hidegrid: false
            });

            // Add selection  默认选择
            $("#list1").setSelection(4, fals);


            // Setup buttons
            $("#list1").jqGrid('navGrid', '#pager1', {
                edit: false,
                add: false,
                del: false,
                search: true
            }, {
                height: 200,
                reloadAfterSubmit: true
            });

            // Add responsive to jqGrid
            $(window).bind('resize', function () {
                var width = $('.jqGrid_wrapper').width();
                $('#list1').setGridWidth(width);
            });
        };
        
</script>